package com.zyasdk.service;

import android.content.Context;

import com.zyasdk.model.ARModel;
import com.zyasdk.util.Base64;
import com.zyasdk.util.JSONHelper;
import com.zyasdk.util.StaticSetting;
import com.zyasdk.util.Util;

import org.json.JSONObject;

public class BaseService {
	Context context;

	public BaseService(Context context) {
		this.context = context;
	}

	protected ARModel getARModel(JSONObject object) {
		ARModel model = null;
		try {
			if (object != null) {
				model = JSONHelper.parseObject(object, ARModel.class);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return model;
	}

	protected String getPBindKey() {
		return new String(Base64.decode(
				Util.toStringHex(StaticSetting.PROJECTBINDKEY).getBytes(),
				Base64.DEFAULT));
	}

	protected String GetAPIUrl(String Method) {
		//Log.e("tag", "GetAPIUrl: "+StaticSetting.API_SERVICEPATH + "Api/" + Method);
		return StaticSetting.API_SERVICEPATH + "Api/" + Method;
	}
}
